import random
from typing import List, Tuple

def generate_test_cases(num_cases: int = 5) -> List[Tuple[List[int], bool]]:
    """
    生成测试用例
    
    Args:
        num_cases: 要生成的测试用例数量
    
    Returns:
        List[Tuple[List[int], bool]]: 测试用例列表，每个用例包含输入数组和预期结果
    """
    test_cases = []
    
    # 基础测试用例
    test_cases.extend([
        ([2, 3, 1, 1, 4], True),    # 示例1
        ([3, 2, 1, 0, 4], False),   # 示例2
        ([0], True),                # 单个元素
        ([1, 0, 1, 0], False),      # 无法到达终点
    ])
    
    # 生成随机测试用例
    for _ in range(num_cases):
        n = random.randint(1, 10)  # 数组长度
        nums = [random.randint(0, 5) for _ in range(n)]  # 生成随机数组
        
        # 确保最后一个元素不为0
        nums[-1] = random.randint(1, 5)
        
        # 计算预期结果
        max_reach = 0
        can_reach = True
        for i, num in enumerate(nums):
            if i > max_reach:
                can_reach = False
                break
            max_reach = max(max_reach, i + num)
            if max_reach >= len(nums) - 1:
                break
        
        test_cases.append((nums, can_reach))
    
    return test_cases

if __name__ == "__main__":
    # 生成测试用例并打印
    test_cases = generate_test_cases()
    for i, (nums, expected) in enumerate(test_cases, 1):
        print(f"测试用例 {i}:")
        print(f"输入: {nums}")
        print(f"预期输出: {expected}\n") 